<?php
use yii\helpers\Url;
use yii\web\View;
use app\assets\SyncAsset;
SyncAsset::register($this);
$this->title = $this->context->pageTitle.Yii::$app->params['titleSuffix'];
$this->params['breadcrumbs'] = [
  \Yii::t('common', 'Syncronization'),
  \Yii::t('sync','Package Syncronization')
];
$jsMsgs = $this->context->loadJsMsgs([
  'table',
  'sync',
]);
$this->registerJs("VAM.setVar('LANGUAGE_JS', '".$jsMsgs."');", View::POS_HEAD);
?>
<div class="page-header">
  <h1>
    <?=\Yii::t('common', 'Syncronization')?>
    <small><?=\Yii::t('sync','Package Syncronization')?></small>
  </h1>
</div>
<div class="panel panel-default">
  <div class="panel-heading"> 
    <i class="fa fa-table"></i>
    <?=\Yii::t('sync', 'Package Syncronization List')?>
    <ul class="list-inline list-unstyled pull-right">
      <li>
        <a class="data-table-refresh" href="#" title="<?=\Yii::t('common', 'Click to refresh data')?>">
          <i class="fa fa-refresh"></i>
        </a>
      </li>
      <li>
        <a href="#">
          <i class="fa fa-chevron-up"></i>
        </a>
      </li>
    </ul>
  </div>
  <div class="panel-body pos-r">
    <div id="list-loading-wrap" class="local-loading-wrap"></div>
    <table class="table table-hover table-striped table-bordered" id="data-table-list" data-tag="vm-adserver.package-sync-list">
      <thead>
        <tr>
          <th class="" data-resizable-column-id="name" data-search="on" data-filter="on"><?=\Yii::t('sync', 'Package Type')?></th>
          <th class="" data-resizable-column-id="config-date" data-search="on" data-filter="on"><?=\Yii::t('sync', 'Start Time')?></th>
          <th class="" data-resizable-column-id="modified_date" data-search="on" data-filter="on"><?=\Yii::t('sync', 'End Time')?></th>
          <th class="" data-resizable-column-id="operate"><?=\Yii::t('sync', 'Actions')?></th>
        </tr>
      </thead>
      <tbody>
        <tr role="row">
          <td class="text-center dataTables_empty" colspan="4"><?=\Yii::t('common', 'No record')?></td>
        </tr>         
      </tbody>
    </table>
  </div>
</div>
<?php
  // $dataUrl = Yii::getAlias('@web').'/response/package/packageList.php';
  $dataUrl = Url::to(['get-package-schedule-list']);
  $syncHandleUrl = Url::to(['sync-handle']);
  $this->registerJs("VAM.setVar('DATA_LIST_URL','$dataUrl');", View::POS_HEAD);
  $this->registerJs("VAM.setVar('SYNC_HANDLE_URL','$syncHandleUrl');", View::POS_HEAD);
?>
<script type="text/javascript" >
  requirejs(["<?= Yii::getAlias('@web/').Yii::$app->params['envDir'];?>/js/site.js"], function(common) {
    requirejs(["<?= Yii::getAlias('@web/').Yii::$app->params['envDir'];?>/js/package/packageSync.js"]);
  });
</script>